package ar.edu.unlp.info.tesis.controladores.lrs;

import java.util.Date;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import ar.edu.unlp.info.tesis.controladores.lrs.exceptions.StatementException;
import ar.edu.unlp.info.tesis.domain.Agent;


public class StateAPIController extends ExperienceAPIController{

	@RequestMapping(method = RequestMethod.GET, headers = "Accept=application/json")
	@ResponseBody
	public ResponseEntity<Object> get(@RequestParam(value="activityId", required=false) String activityId, @RequestParam(value="agent", required=false) Agent agent, @RequestParam(value="registration") String registration, @RequestParam(value="stateId") String stateId, @RequestParam(value="since") Date since) throws Exception
	{
		if(stateId == null && since == null)
			throw new StatementException("You must specified 'stateId' or 'since' parameter", HttpStatus.BAD_REQUEST);
		
		return new ResponseEntity<Object>(HttpStatus.OK);
	}
	
	@RequestMapping(method = RequestMethod.PUT, headers = "Accept=application/json")
	@ResponseBody
	public ResponseEntity<String> put(@RequestParam(value="activityId", required=true) String activityId, @RequestParam(value="agent", required=true) Agent agent, @RequestParam(value="registration") String registration, @RequestParam(value="stateId", required=true) String stateId) throws Exception
	{
		return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
	}
	
	@RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
	@ResponseBody
	public ResponseEntity<String> post(@RequestParam(value="activityId", required=true) String activityId, @RequestParam(value="agent", required=true) Agent agent, @RequestParam(value="registration") String registration, @RequestParam(value="stateId", required=true) String stateId) throws Exception
	{
		return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
	}
	
	@RequestMapping(method = RequestMethod.DELETE, headers = "Accept=application/json")
	@ResponseBody
	public ResponseEntity<String> delete(@RequestParam(value="activityId", required=true) String activityId, @RequestParam(value="agent", required=true) Agent agent, @RequestParam(value="registration") String registration, @RequestParam(value="stateId") String stateId) throws Exception
	{
		return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
	}
}
